package thread_base.thread_safe;

import annotation.NotThreadSafe;

import java.util.concurrent.atomic.AtomicReference;

@NotThreadSafe
public class LazyInitRace {

    private ExpensiveObject instance = null;

    public ExpensiveObject getInstance() {
        if (instance == null) {
            instance = new ExpensiveObject();
        }

        return instance;
    }

    class ExpensiveObject {}

}
